#!/usr/bin/evn python
# -*- coding: UTF-8 -*-
# @File: Calculator.py
# @Author: fy
# @date: 2021/8/23 17:47

class Calculator(object):

    # 坑一，重载__new__方法必须有返回值，否则返回None
    def __new__(cls, *args, **kwargs):
        print("Calculator new")
        # return is must, 否则返回None  __new__是创建对象实例
        return super(Calculator, cls).__new__(cls)

    def __init__(self):
        print("Calculator init")

    def Div(self, numA, numB):
        try:
            return numA/numB
        except ZeroDivisionError:
            return "division zero"
        except:
            return False

    def Min(self, numA, numB):
        try:
            return numA - numB
        except:
            return False
